package com.cet.programmercarl.algorithmperformancanalysis.链表;

/**
 * @program: algorithm
 * @description: 链表反转
 * @author: 陈恩涛
 * @create: 2022-03-11 17:27
 **/
public class LC206 {
    public static ListNode reverseList(ListNode head) {
        ListNode current = head;
        ListNode pre = null;

        while (current != null) {
            ListNode temp = current.next;
            current.next = pre;
            pre = current;
            current = temp;
        }

        return pre;
    }

    public static void main(String[] args) {

    }
}
